package org.yray.sip.constant;

import java.util.HashMap;
import java.util.Map;

/**
 * public final static String SIP_CODE_480="480";
 public final static String SIP_CODE_503="503";
 public final static String SIP_CODE_500="500";
 public final static String SIP_CODE_487="487";

 */
public enum SipCodeEnum  {

    //正常
    SIP_100("100", "100"),
    SIP_180("180", "180"),
    SIP_183("183", "183"),

    //错误
    SIP_503("503", "503"),
    SIP_500("500", "500"),
    SIP_480("480", "480"),
    SIP_486("486", "486"),
    SIP_487("487", "487"),
    SIP_488("488", "488"),
    SIP_404("404", "404"),
    SIP_408("408", "408"),
    SIP_603("603", "603"),

    //自定义的
    SIP_5XX("5XX", "5XX"),
    SIP_4XX("4XX", "4XX"),
    SIP_OK_A("OK_A", "OK_A"),
    SIP_OK_B("OK_B", "OK_B"),
    SIP_BYE_A("BYE_A", "BYE_A"),
    SIP_BYE_B("BYE_B", "BYE_B"),
    SIP_OUTTIME("OUTTIME", "OUTTIME"),
    SIP_701("701", "自定义机器人全繁忙"),
    ;
    private static Map<String, SipCodeEnum> enumMap = new HashMap<>();

    static {
        for (SipCodeEnum en : SipCodeEnum.values()) {
            enumMap.put(en.getValue(), en);
        }
    }

    SipCodeEnum(String value, String displayName) {
        this.value = value;
        this.displayName = displayName;
    }
    private String value;
    private String displayName;

    public static SipCodeEnum parseCode(String code)
    {
       return enumMap.get(code);
    }


    public String getValue() {
        return value;
    }


    public String getDisplayName() {
        return displayName;
    }
}
